package butines.core.game.steering;

import java.awt.Color;
import java.awt.Graphics2D;

import butines.core.game.Vehicle;
import butines.core.math.Vector2f;

public class Annotation {

	private Color vColor = new Color(255, 102, 255); // pinkish
	private Color aColor = new Color(102, 102, 255); // bluish

	
	private Graphics2D g;
	
	public void line(Vector2f p1, Vector2f p2, Color c) {
		int x1 = Math.round(p1.x);
		int y1 = Math.round(p1.y);
		int x2 = Math.round(p2.x);
		int y2 = Math.round(p2.y);
		g.setColor(c);
		g.drawLine(x1, y1, x2, y2);
	}
	
	public void drawVelocityAcceleration(Vehicle vehicle, float maxLengthAcceleration, float maxLengthVelocity)	{
		float aScale = maxLengthAcceleration / vehicle.getMaxForce();
		float vScale = maxLengthVelocity / vehicle.getMaxSpeed();
		
		Vector2f p = vehicle.getPosition().copy();
		
		Vector2f v = p.copy();
		Vector2f.multAdd(vehicle.getVelocity(), vScale, v);
		
		Vector2f a = p.copy();
		Vector2f.multAdd(vehicle.getAccel(), aScale, a);
		
		line(p, v, vColor);
		line(p, a, aColor);
	}
}
